// 设置session
export function setContextData(key, value) {
  if (typeof value === 'string') {
    sessionStorage.setItem(key, value)
  } else {
    sessionStorage.setItem(key, JSON.stringify(value))
  }
}
// 取sessionStorage里的值
export function getContextData(key) {
  const str = sessionStorage.getItem(key)
  if (typeof str === 'string') {
    try {
      return JSON.parse(str)
    } catch (e) {
      return str
    }
  }
}
// 移除session
export function removeCache(name) {
  if (!name) return
  window.sessionStorage.removeItem(name)
}
